let util = require('util');
let mysqlPool = require('./MySQLPool');


/**
 *
 * @param {{club_id: String, m_uid: String, o_uid: String, coins: Number, remark: String}} ClubCoinsUpdateRecord
 * @returns {Promise<*>}
 */
class ClubCoinsUpdateRecordDao {
    constructor() {
    }

    async save(ClubCoinsUpdateRecord){
        // club_coins_update_record
        // let order = {
        //     club_id: clubId,
        //     m_uid: uid,
        //     o_uid: memberUid,
        //     coins: coins,
        //     remark: "群主操作",
        // };
    let sql = 'insert into club_coins_update_record (club_id, m_uid, o_uid, coins, remark, create_time, update_time)' +
        '                           values          (?,       ?,     ?,     ?,     ?,       now(),       now())';
        let args = [ClubCoinsUpdateRecord.club_id, ClubCoinsUpdateRecord.m_uid, ClubCoinsUpdateRecord.o_uid, ClubCoinsUpdateRecord.coins, ClubCoinsUpdateRecord.remark];
        let res = await mysqlPool.query(sql, args);
        if (res) {
            return res.insertId;
        }

        return 0;
    }
}

let clubCoinsUpdateRecordDao = new ClubCoinsUpdateRecordDao();
module.exports = clubCoinsUpdateRecordDao;